home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 56000tar.z / 56000tar / 56000 / boot / boot.art next >
Text File  |  1992-04-28  |  7KB  |  130 lines

  1. Many DSP56001 designs require that the target hardware boot from an external
  2. byte-wide EPROM. Often, getting the user's code into bootable form raises  
  3. questions regarding the use of overlay addresses (i.e., separate runtime
  4. and loadtime address counters) and the generation of files in formats
  5. which will be accepted by standard EPROM programming equipment.
  6.  
  7.  
  8.  
  9. ** DSP56001 bootstrap operation **
  10.  
  11. Upon leaving reset, the DSP56001 samples the MODA/IRQA and MODB/IRQB pins
  12. in order to determine the initial operating mode. If MODA/IRQA is at a 
  13. logic "1" and MODB/IRQB is at a logic "0", the device will enter the 
  14. bootstrap mode and will then sample Data Bit 23 at address P:$C000. If this
  15. bit is read as a logic "0", the bootstrap process will expect to receive
  16. code through the Host Interface of the DSP56001.  If this bit is sensed
  17. as a logic "1", then the device will load its initial operating instructions
  18. from byte-wide memory located on the external data bus.
  19.  
  20. When booting from external byte-wide memory, the DSP56001 first retrieves 
  21. the data on bits 0-7 of the external data bus at address P:$C000. This byte 
  22. is assumed to be the low byte of a 24-bit word. The bytes at P:$C001 and 
  23. P:$C002 are then read and assumed to be the middle and upper bytes 
  24. (respectively) of the first 24-bit instruction word. The first 24-bit 
  25. instruction word is then constructed from these 3 bytes and placed into 
  26. on-chip Program Memory at address p:0000.  
  27. The next 3 bytes read from the EPROM at P:$C003, P:$C004
  28. and P:$C005 are used to construct the instruction word which is placed into
  29. on-chip Program memory at P:0001.  This process continues until the entire
  30. 512 words of internal Program Memory are filled from EPROM data. When this
  31. on-chip program memory has been loaded, the DSP56001 starts executing code
  32. at P:0000.  It is crucial that the module be written such that orderly
  33. execution begins at this address, P:0000, the Reset Vector.
  34.  
  35.  
  36. *** a simple example ***
  37.  
  38. A simple example will serve as our vehicle for demonstrating the steps 
  39. necessary to generate a bootable EPROM.  The entire code module for this 
  40. example appears boot.asm.  The main task of this module is to toggle 
  41. the LSB of Port-C so that the user may confirm proper boot operation 
  42. through an oscilloscope attached to that I/O pin. This simplistic piece
  43. of code would normally contain the user's application or a more 
  44. sophisticated loader which would initialize external X:, Y; and/or P:
  45. memory from a different portion of the EPROM.
  46.  
  47. The ORG directive merits discussion.  In particular, the second ORG
  48. directive uses some interesting techniques.  In this case, we need to assemble
  49. code which will EXECUTE in P:memory at  an address referred to by the
  50. symbol "main".  This symbol has been previously set to the value $50, so
  51. this code will be assembled to start at P:$0050.  The EPROM which contains
  52. the program will be mapped into the DSP56001's Program Memory at P:$C000, due
  53. to the dictates of the device bootstrap procedure.  This dilemma is solved
  54. through the second portion of the ORG directive where a loadtime address is
  55. specified.  
  56.  
  57. Recall that the EPROM is a byte-wide device and requires three
  58. sequential addresses for each 24-bit word stored in this non-volatile device.
  59. The second element in the ORG directive is an expression which computes the
  60. appropriate EPROM address for this portion of the code.  This expression 
  61. starts by multiplying the beginning address of this segment of code by 3.
  62. This compensates for the fact that 3 addresses were occupied for each single
  63. 24-bit word located in EPROM.  Additionally, the EPROM begginning address
  64. of $C000 was added to this product in order to offset the addresses as 
  65. required by the EPROM mapping.
  66.  
  67. At this point, the assembler has been directed to generate code for execution 
  68. at P:$0050 but the actual addresses sent to the load file start at p:$C0F0. 
  69. This is the proper address for the first byte (the lower byte...) which will
  70. used to construct the 24-bit word destined for P:$0050 in the DSP56001's
  71. on-chip P:RAM.  
  72.  
  73. A simple warning message is conditionally assembled in the event that
  74. the user's code size exceeds the amount of P:RAM on-chip. This may be
  75. particularly helpful during code development where code size is continuously
  76. being altered. 
  77.  
  78.  
  79. **** the interrupt vector table ****
  80.  
  81. The first $40 locations of DSP56001 on-chip P:memory are used for interrupt
  82. vectors.  It is a good practice to initialize these locations in such a 
  83. manner as to gracefully accomodate unexpected interrupts. Since booting the 
  84. DSP56001 from EPROM will always fill these locations, initializing the
  85. vectors has no effect on the boot timing.  Perhaps the easiest way to
  86. accomplish this initialization is the fill the vectors with NOPs as is
  87. shown in the example. As a minimum, this technique reduces unexpected
  88. interrupts to Fast Interrupts in which two NOPs are executed and the machine
  89. returns to the normal execution stream. The disadvantage of the approach is
  90. that the errant behavior will add a slight delay to the execution of the main
  91. program while the Fast Interrupt is serviced.
  92.  
  93.  
  94. *** making a EPROM programmer compatible file ***
  95.  
  96. The program can be assembled with a single command line as follows:
  97.  
  98.         asm56000 -a -b -l boot
  99.  
  100. This produces a listing file (boot.lst) as well as the  load file boot.lod.
  101. If you are using version 4 or later of the Assembler/Linker, you will need to
  102. use the CLDLOD utility to convert the file to a .LOD file; CLDLOD is
  103. available for download in "software/tools."
  104.  
  105. The utility SREC can be used to generate S-RECORD formatted output files which
  106. are used by most standard EPROM programming hardware. The following command
  107. line will generate a single S-RECORD file (boot.p) which will be ready
  108. to send to the EPROM programmer:
  109.  
  110.         srec boot
  111.  
  112. The output file from this utility is an ASCII file (S-RECORDS are ASCII).
  113. Note that after the standared S-record preamble 
  114. information (including the EPROM address), the data is presented in the 
  115. order of least-, middle- and then most-significant byte.  This is the 
  116. proper order for the bootstrap process on the DSP56001.  Note that the
  117. next-to-last record in boot.p points to address $C0F0, an address which is
  118. NOT contiguous with the previous records.  The code has specified that
  119. NOPs are to be place in the first $40 address, but then the next segment of
  120. code is to be placed in a different portion of the EPROM. The contents of 
  121. the addresses which occur between the end of the first segment and the start
  122. of the second segment of code will NOT be programmed and will generally
  123. contain $FF - the default value for non-programmed (i.e., erased) EPROM bits.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.